package com.itheima.controller;

import com.itheima.entity.CertificationInformation;
import com.itheima.entity.ProjectReviewProgress;
import com.itheima.result.PageResult;
import com.itheima.service.ICertificationInformationService;
import com.itheima.utils.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/certification")
public class CertificationInformationController {
    @Autowired
    private ICertificationInformationService informationService;

    // 查询用户认证数据列表
    @GetMapping
    @ApiOperation(value = "查询用户认证数据列表")
    public Result<PageResult> findById(CertificationInformation certificationInformation) {
        PageResult pageResult = informationService.selectCertificationInformationList(certificationInformation);
        return Result.success(pageResult);
    }


    //新增
    @PostMapping
    @ApiOperation(value = "新增用户认证数据")
    public Result add(@RequestBody List<CertificationInformation> certificationInformationList) {
        return Result.success(informationService.insertCertificationInformation(certificationInformationList));
    }


    //修改
    @PutMapping
    @ApiOperation(value = "修改用户认证数据")
    public Result update(@RequestBody CertificationInformation information) {
        return Result.success(informationService.updateCertificationInformation(information));
    }


    /**
     * 批量删除
     */
    @DeleteMapping
    @ApiOperation(value = "批量删除用户认证数据")
    public Result remove(@RequestParam Long[] ids)
    {
        return Result.success(informationService.deleteCertificationInformationByIds(ids));
    }

}
